/**
 * @param {number[]} nums
 * @return {number}
 */
var missingNumber = function(nums) {
    let left = 0
    let right = nums.length -1
    while (left <= right) {
        let mid = Math.floor(left + (right - left) / 2)
        if (nums[mid] == mid) {
            left = mid + 1
        }else if (nums[mid] != mid) {
            right = mid - 1
        }
    }
    return left
};
let nums = [0,1,3]
console.log(missingNumber(nums))